<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class ChangeColumnTypeInPlanTable extends AbstractMigration
{
    public function up()
    {

        $this->table('plan')
            ->changeColumn('type', 'enum', ['values' => 'episode,step_category,entity,entity_step_category,to_do', 'default' => 'step_category', 'comment' => '类型 episode 集,step_category 工序分类任务，entity 实体,entity_step_category 实体工序分类,todo 待办'])
            ->addColumn('task_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '待办ID'])
            ->save();
    }

    public function down()
    {
        $this->table('plan')
            ->changeColumn('type', 'enum', ['values' => 'episode,step_category,entity,entity_step_category', 'default' => 'step_category', 'comment' => '类型 episode 集,step_category 工序分类任务，entity 实体,entity_step_category 实体工序分类'])
            ->removeColumn('task_id')
            ->save();
    }
}
